<!DOCTYPE html>

<html xmlns:th="https://www.thymeleaf.org"
  th:replace="~{fragments/layout :: layout (~{::body},'owners')}">

  <body>
  
  
    <h2>Informaţia despre proprietar</h2>
  
  
    <table class="table table-striped" th:object="${owner}">
      <tr>
        <th>Numele</th>
        <td><b th:text="*{firstName + ' ' + lastName}"></b></td>
      </tr>
      <tr>
        <th>Adresa</th>
        <td th:text="*{address}" /></td>
      </tr>
      <tr>
        <th>Localitate</th>
        <td th:text="*{city}" /></td>
      </tr>
      <tr>
        <th>Telefon</th>
        <td th:text="*{telephone}" /></td>
      </tr>
    </table>
  
    <a th:href="@{{id}/edit(id=${owner.id})}" class="btn btn-default">Modifica
    Proprietarul</a>
    <a th:href="@{{id}/pets/new(id=${owner.id})}" class="btn btn-default">Adaugă
    un nou animal</a>
  
    <br />
    <br />
    <br />
    <h2>Animale şi Vizite</h2>
  
    <table class="table table-striped">
  
      <tr th:each="pet : ${owner.pets}">
        <td valign="top">
          <dl class="dl-horizontal">
            <dt>Numele</dt>
            <dd th:text="${pet.name}" /></dd>
            <dt>Data naşterii</dt>
            <dd
              th:text="${#temporals.format(pet.birthDate, 'yyyy-MM-dd')}" /></dd>
            <dt>Tip</dt>
            <dd th:text="${pet.petType}" /></dd>
          </dl>
        </td>
        <td valign="top">
          <table class="table-condensed">
            <thead>
              <tr>
                <th>Data Vizitei</th>
                <th>Descrierea</th>
              </tr>
            </thead>
            <tr th:each="visit : ${pet.visits}">
              <td th:text="${#temporals.format(visit.date, 'yyyy-MM-dd')}"></td>
              <td th:text="${visit?.description}"></td>
            </tr>
            <tr>
              <td><a
                th:href="@{{ownerId}/pets/{petId}/edit(ownerId=${owner.id},petId=${pet.id})}">Editează
              Animalul</a></td>
              <td><a
                th:href="@{{ownerId}/pets/{petId}/visits/new(ownerId=${owner.id},petId=${pet.id})}">Adaugă
              Vizita</a></td>
            </tr>
          </table>
        </td>
      </tr>
  
    </table>
  
  </body>

</html>
